package ru.jexp.rcp.supply.n.commands;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.handlers.HandlerUtil;

import ru.jexp.rcp.supply.actions.IPrintCommand;

public class HandlerExportToExcel extends AbstractHandler
{
	public static final String ID = "ru.jexp.rcp.supply.n.commands.handlerexporttoexcel";
	
	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException
	{
		IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
		if (activeEditor instanceof IPrintCommand)
		{
			IPrintCommand printCmd = (IPrintCommand) activeEditor;
			printCmd.print();
		}
		return null;
	}
}
